RAIS  3.2
C:/Projekte/RAIS/Specific Masks/SealedSourceActivity.aspx.cs
Go to the documentation of this file.
00001 using System;
00002 using System.Collections;
00003 using System.Configuration;
00004 using System.Data;
00005 using System.Linq;
00006 using System.Web;
00007 using System.Web.Security;
00008 using System.Web.UI;
00009 using System.Web.UI.HtmlControls;
00010 using System.Web.UI.WebControls;
00011 using System.Web.UI.WebControls.WebParts;
00012 using System.Xml.Linq;
00013 using RAIS.ApplicationLogicLayer;
00014 using RAIS.Common;
00015 using RAIS.UI.Common;
00016 using RAIS.Common.UserManagement;
00017 namespace RAIS.UI.SpecificMasks
00018 {
00022     public partial class SealedSourceActivity : System.Web.UI.Page
00023     {
00024         //*********************************************************************
00025         #region Properties
00026 
00029         protected UserData CurrentUser
00030         {
00031             get { return (UserData)this.Session[UI.Common.Constants.CURRENT_USER_TAG]; }
00032         }
00033         #endregion
00034         //*********************************************************************
00035         #region Event handlers
00036         protected void Page_PreLoad(object sender, EventArgs e)
00037         {
00038             RAIS.UI.Common.PageManagement.TrimTextBoxValues(this);
00039         }
00046         protected void Page_Load(object sender, EventArgs e)
00047         {
00048             this.Response.Cache.SetNoStore();
00049             if (this.CurrentUser == null)
00050                 UI.Common.AccessManagement.SignOut(this);
00051 
00052             DDLSealedSource.SelectedIndexChanged += new EventHandler(DDLSealedSource_SelectedIndexChanged);
00053             DDLSealedSource.DataBound += new EventHandler(DDLSealedSource_DataBound);
00054             TXTCalculatedActivityDate.TextChanged += new EventHandler(TXTCalculatedActivityDate_TextChanged);
00055             if (!IsPostBack)
00056             {
00057                 Session[UI.Common.Constants.SEALED_SOURCE_COLLECTION] = new SealedSourceCollection(DateTime.Now, CurrentUser.ID);
00058                 BindForm(((SealedSourceCollection)Session[UI.Common.Constants.SEALED_SOURCE_COLLECTION])[0]);
00059                 DDLSealedSource.DataSource = (SealedSourceCollection)Session[UI.Common.Constants.SEALED_SOURCE_COLLECTION];
00060                 DDLSealedSource.DataBind();
00061 
00062                 this.LBLusernameNoTranslation.Text = this.CurrentUser.Name;
00063 
00064                 //this.InitializeSearchItems();
00065 
00066                 UI.Common.PageManagement.InitializePageTreeForCategory(this, this.TreeView1, RAIS.Common.Constants.CATEGORY_NAME_TOOLS);
00067                 this.LBLtools.ForeColor = RAIS.UI.Common.Constants.COLOR_OF_MENU_BAR_TEXT_HIGHLIGHT;
00068 //                              this.LBTNmessagebox.Visible = !(this.CurrentUser.FunctionalRole.Type == FunctionRole.FunctionRoleType.Guest);
00069                 RAIS.UI.Common.PageManagement.SelectTreeNode(TreeView1.Nodes[0].ChildNodes, "_URL_PREFIX~/SealedSourceActivity.aspx");
00070                 TreeView1.SelectedNodeStyle.ForeColor = RAIS.UI.Common.Constants.COLOR_OF_MENU_BAR_TEXT_HIGHLIGHT;
00071                         }
00072             LBLerrorDate.Visible = false;
00073             UI.Common.PageManagement.InitHelpMainMenu(LBTNdefault);
00074         }
00081         protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
00082         {
00083             UI.Common.UserManagement.ProcessTreeViewOnRedirect(this.TreeView1);
00084         }
00091         protected void LBTNlogout_Click(object sender, EventArgs e)
00092         {
00093             UI.Common.AccessManagement.SignOut(this);
00094         }
00095 
00096         void TXTCalculatedActivityDate_TextChanged(object sender, EventArgs e)
00097         {
00098             DateTime date;
00099             SealedSourceCollection sealedSource=(SealedSourceCollection)Session[UI.Common.Constants.SEALED_SOURCE_COLLECTION];
00100             if (DateTime.TryParse(((TextBox)sender).Text, out date))
00101             {
00102                 sealedSource.CalculationDate = date;
00103                 BindForm(sealedSource[DDLSealedSource.SelectedIndex]);
00104             }
00105             else
00106             {
00107                 LBLerrorDate.Visible = true;
00108                 ((TextBox)sender).Text = sealedSource.CalculationDate.Date.ToString("dd.MM.yyyy");
00109             }
00110 
00111         }
00112 
00113         void DDLSealedSource_DataBound(object sender, EventArgs e)
00114         {
00115             DropDownList list = (DropDownList)sender;
00116             list.Items.Clear();
00117             foreach (SealedSource item in ((SealedSourceCollection)list.DataSource))
00118                 list.Items.Add(new ListItem(item.RegNumber, Guid.NewGuid().ToString().Replace('-', '_')));
00119         }
00120 
00121         protected void DDLSealedSource_SelectedIndexChanged(object sender, EventArgs e)
00122         {
00123             DropDownList list = (DropDownList)sender;
00124             BindForm(((SealedSourceCollection)Session[UI.Common.Constants.SEALED_SOURCE_COLLECTION])[list.SelectedIndex]);
00125         }
00126         #endregion
00127         //*********************************************************************
00128         #region Private helper methods
00129         private void BindForm(SealedSource sealedSource)
00130         {
00131 
00132             LBLNuclide.Text = sealedSource.Nuclide!=null?sealedSource.Nuclide:"";
00133             LBLNuclide.Visible = sealedSource.Nuclide != null;
00134             LBLNuclideTitle.Visible = sealedSource.Nuclide != null;
00135 
00136             LBLMaximumActivityDate.Text = sealedSource.ActivityDate != null ? sealedSource.ActivityDate : "";
00137             LBLMaximumActivityDate.Visible = sealedSource.ActivityDate != null;
00138 
00139             LBLMaximumActivity.Text = sealedSource.Activity != null ? sealedSource.Activity : "";
00140             LBLMaximumActivity.Visible = sealedSource.Activity != null;
00141 
00142             LBLMaximumActivityTitle.Visible = sealedSource.Activity != null;
00143 
00144             TXTCalculatedActivityDate.Text = sealedSource.CalculationDate != null ? sealedSource.CalculationDate.Date.ToString("dd.MM.yyyy") : "";
00145             TXTCalculatedActivityDate.Visible = sealedSource.Activity != null;
00146 
00147             LBLCalculatedActivity.Text = sealedSource.CalculationActivity != null ? sealedSource.CalculationActivity : "";
00148             LBLCalculatedActivity.Visible = sealedSource.Activity != null;
00149 
00150             LBLCalculatedActivityTitle.Visible = sealedSource.Activity != null;
00151         }
00152         #endregion
00153     }
00154 }